/**
 */
package artefact.umlClassDiagram.impl;

import artefact.generic.ConstructionPrimitive;

import artefact.generic.impl.ConstructionPrimitiveImpl;

import artefact.umlClassDiagram.CreateStatement;
import artefact.umlClassDiagram.StatementName;
import artefact.umlClassDiagram.UmlClassDiagramPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Create Statement</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link artefact.umlClassDiagram.impl.CreateStatementImpl#getText <em>Text</em>}</li>
 *   <li>{@link artefact.umlClassDiagram.impl.CreateStatementImpl#getOwnerOperation <em>Owner Operation</em>}</li>
 *   <li>{@link artefact.umlClassDiagram.impl.CreateStatementImpl#getOwnerClass <em>Owner Class</em>}</li>
 *   <li>{@link artefact.umlClassDiagram.impl.CreateStatementImpl#getOwnerBlock <em>Owner Block</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class CreateStatementImpl extends ConstructionPrimitiveImpl implements CreateStatement {
	/**
	 * The default value of the '{@link #getText() <em>Text</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getText()
	 * @generated
	 * @ordered
	 */
	protected static final String TEXT_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getText() <em>Text</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getText()
	 * @generated
	 * @ordered
	 */
	protected String text = TEXT_EDEFAULT;

	/**
	 * The default value of the '{@link #getOwnerOperation() <em>Owner Operation</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOwnerOperation()
	 * @generated
	 * @ordered
	 */
	protected static final String OWNER_OPERATION_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getOwnerOperation() <em>Owner Operation</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOwnerOperation()
	 * @generated
	 * @ordered
	 */
	protected String ownerOperation = OWNER_OPERATION_EDEFAULT;

	/**
	 * The default value of the '{@link #getOwnerClass() <em>Owner Class</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOwnerClass()
	 * @generated
	 * @ordered
	 */
	protected static final String OWNER_CLASS_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getOwnerClass() <em>Owner Class</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOwnerClass()
	 * @generated
	 * @ordered
	 */
	protected String ownerClass = OWNER_CLASS_EDEFAULT;

	/**
	 * The cached value of the '{@link #getOwnerBlock() <em>Owner Block</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOwnerBlock()
	 * @generated
	 * @ordered
	 */
	
	// A documenter
	protected ConstructionPrimitive ownerBlock;
		
	// A documenter
	protected StatementName statementName;
	


	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CreateStatementImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return UmlClassDiagramPackage.Literals.CREATE_STATEMENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getText() {
		return text;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setText(String newText) {
		String oldText = text;
		text = newText;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, UmlClassDiagramPackage.CREATE_STATEMENT__TEXT, oldText, text));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getOwnerOperation() {
		return ownerOperation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setOwnerOperation(String newOwnerOperation) {
		String oldOwnerOperation = ownerOperation;
		ownerOperation = newOwnerOperation;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_OPERATION, oldOwnerOperation, ownerOperation));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getOwnerClass() {
		return ownerClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setOwnerClass(String newOwnerClass) {
		String oldOwnerClass = ownerClass;
		ownerClass = newOwnerClass;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_CLASS, oldOwnerClass, ownerClass));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConstructionPrimitive getOwnerBlock() {
		if (ownerBlock != null && ownerBlock.eIsProxy()) {
			InternalEObject oldOwnerBlock = (InternalEObject)ownerBlock;
			ownerBlock = (ConstructionPrimitive)eResolveProxy(oldOwnerBlock);
			if (ownerBlock != oldOwnerBlock) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_BLOCK, oldOwnerBlock, ownerBlock));
			}
		}
		return ownerBlock;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConstructionPrimitive basicGetOwnerBlock() {
		return ownerBlock;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setOwnerBlock(ConstructionPrimitive newOwnerBlock) {
		ConstructionPrimitive oldOwnerBlock = ownerBlock;
		ownerBlock = newOwnerBlock;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_BLOCK, oldOwnerBlock, ownerBlock));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case UmlClassDiagramPackage.CREATE_STATEMENT__TEXT:
				return getText();
			case UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_OPERATION:
				return getOwnerOperation();
			case UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_CLASS:
				return getOwnerClass();
			case UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_BLOCK:
				if (resolve) return getOwnerBlock();
				return basicGetOwnerBlock();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case UmlClassDiagramPackage.CREATE_STATEMENT__TEXT:
				setText((String)newValue);
				return;
			case UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_OPERATION:
				setOwnerOperation((String)newValue);
				return;
			case UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_CLASS:
				setOwnerClass((String)newValue);
				return;
			case UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_BLOCK:
				setOwnerBlock((ConstructionPrimitive)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case UmlClassDiagramPackage.CREATE_STATEMENT__TEXT:
				setText(TEXT_EDEFAULT);
				return;
			case UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_OPERATION:
				setOwnerOperation(OWNER_OPERATION_EDEFAULT);
				return;
			case UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_CLASS:
				setOwnerClass(OWNER_CLASS_EDEFAULT);
				return;
			case UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_BLOCK:
				setOwnerBlock((ConstructionPrimitive)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case UmlClassDiagramPackage.CREATE_STATEMENT__TEXT:
				return TEXT_EDEFAULT == null ? text != null : !TEXT_EDEFAULT.equals(text);
			case UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_OPERATION:
				return OWNER_OPERATION_EDEFAULT == null ? ownerOperation != null : !OWNER_OPERATION_EDEFAULT.equals(ownerOperation);
			case UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_CLASS:
				return OWNER_CLASS_EDEFAULT == null ? ownerClass != null : !OWNER_CLASS_EDEFAULT.equals(ownerClass);
			case UmlClassDiagramPackage.CREATE_STATEMENT__OWNER_BLOCK:
				return ownerBlock != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (text: ");
		result.append(text);
		result.append(", ownerBlock: ");
		result.append(ownerBlock);
		result.append(", ownerOperation: ");
		result.append(ownerOperation);
		result.append(", ownerClass: ");
		result.append(ownerClass);
		result.append(')');
		return result.toString();
	}

	// a documenter
	public StatementName getStatementName() {
		return statementName;
	}

	// a documenter
	public void setStatementName(StatementName statementName) {
		this.statementName = statementName;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CreateStatementImpl other = (CreateStatementImpl) obj;
		if (statementName != other.statementName)
			return false;
		return true;
	}
	
	
	
	
	
} //CreateStatementImpl
